package cn.hou.java.designpattern._20commod;

import java.util.ArrayList;
import java.util.List;
//命令的请求者,用于接受客户端的命令,对各个命令进行控制(设置,取消等)
public class Assistant {
	//命令集合
	private List<ICommand> list=new ArrayList<ICommand>();
	//设置命令
	public void setCommand(ICommand command){
		this.list.add(command);
	};
	//取消命令
	public void cancelCommand(ICommand command){
		this.list.remove(command);
	};
	//调用命令
	public void excute(){
		//执行设置的命令
		list.forEach(x->x.excute());
	}
}
